package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduSchoolAccountIntegration;
import com.jwsoft.manager.common.vo.eduSchoolAccount.EduSchoolAccountVO;
import com.jwsoft.manager.common.vo.eduSchoolAccount.EduSchoolAccountKeyVO;
import com.jwsoft.manager.common.vo.eduSchoolAccount.EduSchoolAccountQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 学校登录账号控制表网关
 *
 * @author chenzh
 * @since 2024-04-12
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "学校登录账号控制表", description = "学校登录账号控制表")
public class EduSchoolAccountController {

    @Autowired
    public EduSchoolAccountIntegration eduSchoolAccountIntegration;

    @Operation(summary = "学校登录账号控制表分页查询",description = "学校登录账号控制表分页查询")
    @PostMapping(value = "/eduSchoolAccount0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSchoolAccountVO>> getList(@RequestBody @Validated EduSchoolAccountQueryVO vo) {
        return AppResponse.successData(eduSchoolAccountIntegration.getList(vo));
    }

    @Operation(summary = "学校登录账号控制表根据主键查询详情",description = "学校登录账号控制表根据主键查询详情")
    @PostMapping(value = "/eduSchoolAccount0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolAccountVO> getById(@RequestBody @Validated EduSchoolAccountKeyVO vo) {
        return AppResponse.successData(eduSchoolAccountIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校登录账号控制表新增",description = "学校登录账号控制表新增")
    @PostMapping(value = "/eduSchoolAccount0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolAccountVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSchoolAccountVO vo) {
        return AppResponse.successData(eduSchoolAccountIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校登录账号控制表修改",description = "学校登录账号控制表修改")
    @PostMapping(value = "/eduSchoolAccount0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolAccountVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSchoolAccountVO vo) {
        return AppResponse.successData(eduSchoolAccountIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校登录账号控制表删除",description = "学校登录账号控制表删除")
    @PostMapping(value = "/eduSchoolAccount0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSchoolAccountKeyVO vo) {
        eduSchoolAccountIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
